home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
clipper
/
rlib20.zip
/
DEMOPROC.PRG
< prev
next >
Wrap
Text File
|
1989-02-18
|
15KB
|
549 lines
******************************************************************************
* THIS FILE CONTAINS THE PROCEDURES WHICH ACTUALLY DEMONSTRATE THE FUNCTIONS *
******************************************************************************
*-----------------------------------------------------------------------------
PROCEDURE d_atinsay
mrow = 21
mcol = 20
mcolor = 'W+*/N '
mtext = ' Testing: 1, 2, 3 '
DO ClearTop
@ 3,0,11,79 BOX double
@ 5, 1 SAY 'Enter row,colum coordinates ,'
@ 5,29 GET mrow PICTURE '##' RANGE 0,24
@ 5,32 GET mcol PICTURE '##' RANGE 0,79
@ 6, 1 SAY 'Enter Clipper color string ' GET mcolor PICTURE "@!"
@ 7, 1 SAY 'Enter the text to display ' GET mtext PICTURE "@K"
SET CURSOR ON
READ
SET CURSOR OFF
ATINSAY( mrow, mcol, mcolor, mtext )
CENTER( 10, 'Press any key to continue...' )
INKEY(10)
RETURN
*-----------------------------------------------------------------------------
PROCEDURE d_boxask
DO ClearTop
SET CURSOR ON
@ 3,0,11,79 BOX double
@ 5,1 SAY 'Enter two lines of text to appear in BOXASK (up to 65 characters each)'
@ 7,1 SAY 'Line #1: '
mline1 = KEYINPUT( 65, .F., .T. )
@ 8,1 SAY 'Line #2: '
mline2 = KEYINPUT( 65, .F., .T. )
answer = BOXASK( mline1, mline2, 'Now press any key...' )
BOXASK( 'You pressed the ' + answer + ' key in response to BOXASK',;
'Press any key to continue...', 30 )
SET CURSOR OFF
RETURN
*-----------------------------------------------------------------------------
PROCEDURE d_bright
DO ClearTop
SET CURSOR ON
mcolor = PAD(SETCOLOR(),20)
@ 4,5,7,68 BOX double
@ 5,12 SAY 'Enter a Clipper color string:' GET mcolor
READ
@ 6,12 SAY 'The BRIGHT() of this color is: ' + BRIGHT(mcolor)
SET CURSOR OFF
INKEY(10)
RETURN
*-----------------------------------------------------------------------------
PROCEDURE d_center
DO ClearTop
SET CURSOR ON
mstring = PAD('Greetings to all Clipper programmers!',78)
@ 4,0,7,79 BOX double
CENTER(5,'Enter a string to be centered')
@ 6,1 GET mstring PICTURE "@K"
READ
@ 6,1 SAY SPACE(78)
CENTER(6,ALLTRIM(mstring))
SET CURSOR OFF
INKEY(10)
RETURN
*-----------------------------------------------------------------------------
PROCEDURE d_sayinbox
DO ClearTop
SET CURSOR ON
@ 3,0,11,79 BOX double
@ 5,1 SAY 'Enter three lines of text to appear in SAYINBOX (up to 65 characters each)'
@ 7,1 SAY 'Line #1: '
mline1 = KEYINPUT( 65, .F., .T. )
@ 8,1 SAY 'Line #2: '
mline2 = KEYINPUT( 65, .F., .T. )
@ 9,1 SAY 'Line #3: '
mline3 = KEYINPUT( 65, .F., .T. )
SAYINBOX( mline1, mline2, mline3, 10 )
SET CURSOR OFF
RETURN
*-----------------------------------------------------------------------------
PROCEDURE d_filedate
DO ClearTop
SET CURSOR ON
mfile = PAD(GETE('COMSPEC'),40)
@ 4,0,7,79 BOX double
CENTER(5,'Enter an existing filename:')
@ 6,CENTER(mfile) GET mfile PICTURE "@!K"
READ
@ 6,1 SAY SPACE(78)
mfile = ALLTRIM(mfile)
CENTER(6, 'Last update date of &mfile is: ' + DTOC(FILEDATE(mfile)) )
SET CURSOR OFF
INKEY(10)
RETURN
*-----------------------------------------------------------------------------
PROCEDURE d_files
DO ClearTop
SET CURSOR ON
mfile1 = PAD('RLIB.LIB',60)
mfile2 = PAD('DEMO.EXE',60)
mfile3 = PAD('DEMO.PRG',60)
@ 4,0,7,79 BOX double
CENTER(5,"Enter files to test for existance:")
@ 6, 2 SAY "#1:" GET mfile1 PICTURE "@!KS20"
@ 6,28 SAY "#2:" GET mfile2 PICTURE "@!KS20"
@ 6,54 SAY "#3:" GET mfile3 PICTURE "@!KS20"
READ
@ 6,1 SAY SPACE(78)
mfile1 = ALLTRIM(mfile1)
mfile2 = ALLTRIM(mfile2)
mfile3 = ALLTRIM(mfile3)
mdisplay = 'FILES("&mfile1", "&mfile2", "&mfile3") = ' +;
IF( FILES(mfile1, mfile2, mfile3), '.T.', '.F.' )
CENTER(6,mdisplay)
SET CURSOR OFF
INKEY(10)
RETURN
*-----------------------------------------------------------------------------
PROCEDURE d_filetime
DO ClearTop
SET CURSOR ON
mfile = PAD(GETE('COMSPEC'),40)
@ 4,0,7,79 BOX double
CENTER(5,'Enter an existing filename:')
@ 6,CENTER(mfile) GET mfile PICTURE "@!K"
READ
@ 6,1 SAY SPACE(78)
mfile = ALLTRIM(mfile)
CENTER(6, 'Last update time of &mfile is: ' + FILETIME(mfile) )
SET CURSOR OFF
INKEY(10)
RETURN
*-----------------------------------------------------------------------------
PROCEDURE d_parent
PRIVATE mdir
DO ClearTop
SET CURSOR ON
mdir = PAD('C:\CLIPPER\LIBS\RLIB\SOURCE',40)
@ 4,0,8,79 BOX double
CENTER(5, 'Press ENTER or type in another directory name:')
@ 6,CENTER(mdir) GET mdir PICTURE "@!K"
READ
@ 6,1 SAY SPACE(78)
CENTER(6,ALLTRIM(mdir))
CENTER(7,'The parent directory is ' + PARENT(mdir) )
SET CURSOR OFF
INKEY(10)
RETURN
*-----------------------------------------------------------------------------
PROCEDURE d_pathto
PRIVATE mfile, mpath
DO ClearTop
SET CURSOR ON
mfile = "CLIPPER.EXE "
@ 4,0,8,79 BOX double
CENTER(5, 'Enter the name of a file which can be found through the DOS path')
CENTER(6, '(Current DOS path is ' + GETE('PATH') + ')')
@ 7,CENTER(mfile) GET mfile PICTURE "@!"
READ
mfile = ALLTRIM(mfile)
mpath = PATHTO(mfile)
IF EMPTY(mpath)
CENTER(7,'&mfile is not located in any directory in the DOS path!')
ELSE
CENTER(7,'&mfile can be found in the &mpath directory')
ENDIF
SET CURSOR OFF
INKEY(10)
RETURN
*-----------------------------------------------------------------------------
PROCEDURE d_pickfile
DO ClearTop
@ 5,15,7,65 BOX double
filespec = '*.*' + SPACE(60)
@ 6,19 SAY 'Enter filespec:' GET filespec PICTURE '@!KS26'
SET CURSOR ON
READ
SET CURSOR OFF
@ 5,15,7,65 BOX single
IF LASTKEY() <> 27
filename = PICKFILE( TRIM(filespec), 1, 0, 24, democolor, .T. )
IF .NOT. EMPTY(filename)
SAYINBOX('You selected &filename',5)
ENDIF
ENDIF
RETURN
*-----------------------------------------------------------------------------
PROCEDURE d_decrypted
PRIVATE mstring, estring, dstring
DO ClearTop
SET CURSOR ON
mstring = SPACE(35)
@ 4,0,8,79 BOX double
@ 5,6 SAY 'Enter a string to be encrypted:' GET mstring
READ
estring = ENCRYPTED(ALLTRIM(mstring))
CENTER(6,'Encrypted version is: &estring')
dstring = DECRYPTED(estring)
CENTER(7,'Decrypted version is: &dstring')
SET CURSOR OFF
INKEY(10)
RETURN
*-----------------------------------------------------------------------------
PROCEDURE d_encrypted
PRIVATE mstring, estring
DO ClearTop
SET CURSOR ON
mstring = SPACE(35)
@ 4,0,7,79 BOX double
@ 5,6 SAY 'Enter a string to be encrypted:' GET mstring
READ
estring = ENCRYPTED(ALLTRIM(mstring))
CENTER(6,'Encrypted version is: &estring')
SET CURSOR OFF
INKEY(10)
RETURN
*-----------------------------------------------------------------------------
PROCEDURE d_getparm
PRIVATE mstring, mnumber, mparm
DO ClearTop
SET CURSOR ON
mstring = 'Red, Orange, Yellow, Green, Blue, Indigo, Violet'
@ 4,0,9,79 BOX double
CENTER(5,'Enter a string with sections separated by commas')
@ 6,CENTER(mstring) GET mstring PICTURE '@K'
READ
mnumber = 4
@ 7,25 SAY 'Enter parameter to retrieve:' GET mnumber PICTURE '#'
READ
mparm = GETPARM(mnumber,mstring)
CENTER(8, 'Parameter #' + STR(mnumber,1,0) + ' is: &mparm')
SET CURSOR OFF
INKEY(10)
RETURN
*-----------------------------------------------------------------------------
PROCEDURE d_keyinput
PRIVATE length, upcase, echoon, mstring
length = 60
upcase = .F.
echoon = .T.
DO ClearTop
@ 3,0,11,79 BOX double
@ 4,2 SAY 'Enter maximum allowed key input length: ' GET length PICTURE '###'
@ 5,2 SAY 'Force characters into upper case? (Y/N):' GET upcase PICTURE 'Y'
@ 6,2 SAY 'Echo characters onto the screen? (Y/N): ' GET echoon PICTURE 'Y'
SET CURSOR ON
READ
@ 8,1 SAY 'Start typing:'
mstring = KEYINPUT(length,upcase,echoon)
@ 10,1 SAY 'You entered: ' + mstring
SET CURSOR OFF
INKEY(10)
RETURN
*-----------------------------------------------------------------------------
PROCEDURE d_namesplit
PRIVATE mname, sname
DO ClearTop
SET CURSOR ON
mname = PAD('Elmer Q. Fudd',35)
@ 4,0,7,79 BOX double
@ 5,6 SAY 'Enter a name to be parsed (split):' GET mname
READ
sname = NAMESPLIT(mname)
CENTER(6,'NAMESPLIT() version is: &sname')
SET CURSOR OFF
INK